package com.hui.platform.mybatisplusgenerator.devops.constant;

import com.baomidou.mybatisplus.core.toolkit.StringPool;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 逆向工程生成文件枚举类
 *
 * @author Peng
 * @date 2019/10/28
 */
@Getter
@ToString
public enum GenFileTypeEnum {

    /*
     * 生成器文件
     */

    /**
     * DO文件
     */
    ENTITY_DO_FILE("", "entity", StringPool.DOT_JAVA, "/templates/entity.java.ftl"),
    /**
     * Mapper文件
     */
    MAPPER_FILE("Mapper", "mapper", StringPool.DOT_JAVA, "/templates/mapper.java.ftl"),
    /**
     * MapperXML文件
     */
    MAPPER_XML_FILE("Mapper", "mapper", StringPool.DOT_XML, "/templates/mapper.xml.ftl"),
    /**
     * Service文件
     */
    SERVICE_FILE("Service", "service", StringPool.DOT_JAVA, "/templates/service.java.ftl"),
    /**
     * ServiceImpl文件
     */
    SERVICE_IMPL_FILE("ServiceImpl", "service.impl", StringPool.DOT_JAVA, "/templates/serviceImpl.java.ftl"),
    /**
     * Controller文件
     */
    CONTROLLER_FILE("Controller", "controller", StringPool.DOT_JAVA, "/templates/controller.java.ftl"),

    /*
     * 自定义文件
     */

    /**
     * BO文件
     */
    ENTITY_BO_FILE("BO", "bo", StringPool.DOT_JAVA, "/templates/custom/entity.bo.java.ftl"),
    /**
     * DTO文件
     */
    ENTITY_DTO_FILE("DTO", "dto", StringPool.DOT_JAVA, "/templates/custom/entity.dto.java.ftl"),
    /**
     * VO文件
     */
    ENTITY_VO_FILE("VO", "vo", StringPool.DOT_JAVA, "/templates/custom/entity.vo.java.ftl"),
    /**
     * 对象转换文件
     */
    ENTITY_CONVERT_FILE("Convert", "convert", StringPool.DOT_JAVA, "/templates/custom/entity.convert.java.ftl"),
    /**
     * Swagger配置文件
     */
    SWAGGER_CONFIG_FILE("SwaggerConfig", "config", StringPool.DOT_JAVA, "/templates/custom/swagger.config.java.ftl"),
    /**
     * Mybatis配置文件
     */
    MYBATIS_CONFIG_FILE("MybatisConfig", "config", StringPool.DOT_JAVA, "/templates/custom/mybatis.config.java.ftl"),
    /**
     * BusinessErrorEnum枚举文件
     */
    BUSINESS_ERROR_ENUM_FILE("BusinessErrorEnum", "constant", StringPool.DOT_JAVA, "/templates/custom/business.error.enum.java.ftl"),
    ;

    //文件名后缀
    private String suffix;
    //相对包名
    private String relativePackageName;
    //文件后缀(.xxx)
    private String fileSuffix;
    //模板位置
    private String templatePath;
    //是否生成
    @Setter
    private boolean enabled = true;

    GenFileTypeEnum(String suffix, String relativePackageName, String fileSuffix, String templatePath) {
        this.suffix = suffix;
        this.relativePackageName = relativePackageName;
        this.fileSuffix = fileSuffix;
        this.templatePath = templatePath;
    }
}
